import request from '@/utils/request'

export function getProjectDetail(params) {
  return request({
    url: 'api/project',
    method: 'get',
    params
  })
}

export function add(data) {
  return request({
    url: 'api/project',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/project/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/project',
    method: 'put',
    data
  })
}

export function start(params) {
  return request({
    url: 'api/project/start',
    method: 'get',
    params
  })
}

// export function startFY(params) {
//   return request({
//     url: 'api/project/start_fy',
//     method: 'get',
//     params
//   })
// }

/* 获取项目状态*/
export function projectStatus(params) {
  return request({
    url: 'api/project/status',
    method: 'get',
    params
  })
}

/* 取得云桌面用户列表*/
export function projectUsersFY(params) {
  return request({
    url: 'api/project/users_fy',
    method: 'get',
    params
  })
}

export function projectUsersZJ(params) {
  return request({
    url: 'api/project/users_zj',
    method: 'get',
    params
  })
}

/* 取得分公司项目数*/
export function projectCount(params) {
  return request({
    url: 'api/project/projectCount',
    method: 'get',
    params
  })
}
/* 按照年份取得分公司项目数*/
export function projectCountByYear(params) {
  return request({
    url: 'api/project/projectCountByYear',
    method: 'get',
    params
  })
}

// 用户云桌面关联详情
export function userDesktopDetail(params) {
  return request({
    url: 'api/userDesktop/detail',
    method: 'get',
    params
  })
}

// 修改更新状态
export function doUpdateStatus(params) {
  return request({
    url: 'api/project/doUpdateStatus',
    method: 'get',
    params
  })
}

// 同步
export function fetchAndSyncAllProjInfo(params) {
  return request({
    url: 'api/projectSyncData/fetchAndSyncAllProjInfo',
    method: 'get',
    params
  })
}

// 收藏项目
export function collectProject(params) {
  return request({
    url: 'api/project/collectProject',
    method: 'get',
    params
  })
}

// 取消收藏项目
export function cancelCollectProject(params) {
  return request({
    url: 'api/project/cancelCollectProject',
    method: 'get',
    params
  })
}

// 获取标杆项目部门列表
export function getInternalDept() {
  return request({
    url: 'api/dept/internalDept',
    method: 'get'
  })
}
// 获取未分组的项目
export function getProjectAll(params) {
  return request({
    url: '/api/flagshipProject/getProjectAll',
    method: 'get',
    params
  })
}

// 获取标杆项目列表
export function getFlagshipProject(params) {
  return request({
    url: 'api/flagshipProject/getFlagshipProject',
    method: 'get',
    params
  })
}

// 更新标杆项目
export function insertOrUpdate(data) {
  return request({
    url: '/api/flagshipProject/insertOrUpdate',
    method: 'post',
    data
  })
}

// 批量删除标杆项目
export function deleteFlagshipProject(data) {
  return request({
    url: '/api/flagshipProject',
    method: 'delete',
    data
  })
}

export default { add, edit, del, start, projectStatus, projectUsersFY, projectUsersZJ, projectCount, userDesktopDetail, doUpdateStatus, fetchAndSyncAllProjInfo, getProjectDetail, collectProject, cancelCollectProject }
